added samples
[windows-sources.git] / sdk / samples / all in on code / Visual Studio 2010 / VBCustomIEContextMenu / NativeMethods / COMRECT.vb
blob677a88f9a837ee2e70318c69aea14d5f845e7cfd
1 '*************************** Module Header ******************************'
2 ' Module Name: COMRECT.vb
3 ' Project: VBCustomIEContextMenu
4 ' Copyright (c) Microsoft Corporation.
5 '
6 ' The class COMRECT is used to define the outer rectangle of the border.
7 '
8 '
9 ' This source is subject to the Microsoft Public License.
10 ' See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
11 ' All other rights reserved.
13 ' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
14 ' EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
15 ' WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
16 '*************************************************************************'
18 Imports System.Drawing
19 Imports System.Runtime.InteropServices
21 Namespace NativeMethods
22 <StructLayout(LayoutKind.Sequential)>
23 Public Class COMRECT
24 Public left As Integer
25 Public top As Integer
26 Public right As Integer
27 Public bottom As Integer
29 Public Overrides Function ToString() As String
30 Return String.Concat(
31 New Object() {" Left = ", Me.left,
32 " Top = ", Me.top,
33 " Right = ", Me.right,
34 " Bottom = ", Me.bottom})
35 End Function
37 Public Sub New()
38 End Sub
40 Public Sub New(ByVal r As Rectangle)
41 Me.left = r.X
42 Me.top = r.Y
43 Me.right = r.Right
44 Me.bottom = r.Bottom
45 End Sub
47 Public Sub New(ByVal left As Integer,
48 ByVal top As Integer,
49 ByVal right As Integer,
50 ByVal bottom As Integer)
51 Me.left = left
52 Me.top = top
53 Me.right = right
54 Me.bottom = bottom
55 End Sub
57 Public Shared Function FromXYWH(ByVal x As Integer,
58 ByVal y As Integer,
59 ByVal width As Integer,
60 ByVal height As Integer) _
61 As NativeMethods.COMRECT
62 Return New NativeMethods.COMRECT(x, y, x + width, y + height)
63 End Function
64 End Class
65 End Namespace